﻿using Swashbuckle.AspNetCore.Annotations;
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Xms.Abp.BackgroundJob;
using Xms.Abp.Data;

namespace BackgroundJobManagement;

public class BackgroundJobResult : ExtensibleFullAuditedEntityWithUserDto<Guid, string>, IHasName, IHasDisplayName, IHasRemark, IHasConcurrencyStamp
{
    [SwaggerSchema("名称")]
    public string Name { get; set; }

    [SwaggerSchema("显示名称")]
    public string DisplayName { get; set; }

    [SwaggerSchema("参数")]
    public string JobArgs { get; set; }

    [SwaggerSchema("执行计划ID")]
    public Guid? ScheduleId { get; set; }

    [SwaggerSchema("执行接话名称")]
    public string ScheduleName { get; set; }

    [SwaggerSchema("重试间隔")]
    public string RetryIntervals { get; set; }

    [SwaggerSchema("执行次数")]
    public short TryCount { get; set; }

    [SwaggerSchema("最大执行次数")]
    public short? MaxTryCount { get; set; }

    [SwaggerSchema("下次执行时间")]
    public DateTime NextTryTime { get; set; }

    [SwaggerSchema("最后执行时间")]
    public DateTime? LastTryTime { get; set; }

    [SwaggerSchema("执行超时时间")]
    public DateTime? TryTimeoutTime { get; set; }

    [SwaggerSchema("任务状态")]
    public BackgroundJobStatus BackgroundJobStatus { get; set; }

    [SwaggerSchema("错误信息")]
    public string ErrorMessage { get; set; }

    [SwaggerSchema("执行超时时间（ms）")]
    public int? Timeout { get; set; }

    [SwaggerSchema("是否废弃")]
    public bool IsAbandoned { get; set; }

    [SwaggerSchema("优先级")]
    public BackgroundJobPriority Priority { get; set; }

    [SwaggerSchema("执行超时时间")]
    public string ReferenceJobs { get; set; }

    [SwaggerSchema("租户ID")]
    public Guid? TenantId { get; set; }

    [SwaggerSchema("租户名称")]
    public string TenantName { get; set; }

    [SwaggerSchema("乐观锁戳")]
    public string ConcurrencyStamp { get; set; }

    [SwaggerSchema("备注")]
    public string Remark { get; set; }
}
